import { Component, Emit, Prop, Provide, Watch } from 'vue-property-decorator'
import { ListBase } from 'src/components/list_base_abs';
import Vue from "vue";
import Creator from './demo_tree_data'
import { DemoTreeHandler } from 'src/views/demo_tree/demo_tree_handler';
@Component({})
export default class DemoTreeTable extends ListBase {
    myState:TreeListData;
    listHandler:IDemoTreeHandler;
    initData(that:DemoTreeTable):void{
        that.myState = Creator.dataCreator();
        that.listHandler = new DemoTreeHandler();
    }

    mounted():void{
        this.getListData();
    }

    getListData():void{
        console.log("demo tree get list data");
        this.listHandler.getListData(this.myState.data);
    }

    message(row:any) {
        this.$message.info(row.event);
    };

    expand(row:any) {
        if(this.listHandler && typeof this.listHandler.expand === 'function'){
            this.listHandler.expand(row);
        }else{
            console.error("IDemoTreeHandler is NULL");
        }
    };
}